package org.stvd.entities.oauth;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;
import org.stvd.core.annotation.serializer.DateTimeSerializer;
import org.stvd.entities.base.BaseEntity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * 授权编码表
 * @author houzx
 */
@Entity
@Table(name = "oauth_code")
public class OauthCode extends BaseEntity{

    private static final long serialVersionUID = 7152158278237992658L;

    /**
     * 授权编码
     */
    @Id
    @Column(name = "code")
    private String code = "";
    
    /**
     * 授权信息
     */
    @Column(name = "authentication")
    private byte[] authentication = null;
    
    /**
     * 创建时间
     */
    @Column(name = "create_time", nullable = false)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateTimeSerializer.class)
    private Date createTime = null;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public byte[] getAuthentication() {
        return authentication;
    }

    public void setAuthentication(byte[] authentication) {
        this.authentication = authentication;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
}
